<template>
  <div>
    <div class="commentdetail-body">
      <div>
        <div v-if="commenttype==null" class="commentdetail-text" @click="reply($event,topicindex,commentindex)">
          <span class="detailcom">{{commenttext}}</span>
        </div>

        <div v-else-if="commenttype!=null" class="commentdetail-text" @click="reply($event,topicindex,commentindex)">
          <span class="detailcom">回复
            <span style="color: #fb685b;"> @ {{atname}} </span>: {{commenttext}}</span>
           <span class="detailcom" v-html="commenttext"></span> 
        </div>
        <div v-if="isdisplacetype==2" class="displace-explain">
          {{description}}
        </div>
        <div>
          <div v-if="piclength>0" >
            <div class="commenturl">
              <img v-lazy="item.src+'?imageMogr2/auto-orient'" class="previewer-demo-img preview-img-item commentimg"  v-for="(item,index) in picarray" :key="index"  @click="saveimgtolocal(picarray,index)">
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="body-sep"></div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      comment: '',
      commentlist: [],
      imgstr:[],//点击跳转幸福绿城app
    }
  },
  props: ['commenttext', 'piclength', 'imgurl', 'picarray', 'isdisplacetype', 'commenttype', 'commentindex', 'topicindex', 'atname', 'description'],
  methods: {
    show() {
    },
    reply(event, topicindex, commentindex) {
      this.$emit("replycomment", { event: event, topicindex: topicindex, commentindex: commentindex })
    },
    saveimgtolocal(imgarray,index){
      this.imgstr=[];
      _each(imgarray,(v,i)=>{
        this.imgstr.push(v.src);
      })
      window.location.href= "image://?url=" + this.imgstr + "&currentIndex=" + index;
    }
  }
}
</script>
<style scoped>
.commentdetail-body {
  display: flex;
  flex-direction: column;
  padding: 0 0rem 0.2rem 0.27rem;
}

.commentdetail-text {
  font-size: 0.28rem;
  color: #111111;
  line-height: 0.42rem;
  width: 6.9rem;
}

.commenturl {
  margin-top: 0.2rem;
  width: 6.9rem;
}

.commentimg {
  width: 100%;
  display: inline-block;
  margin-right: 0.2rem;
  margin-bottom: 0.1rem;
}

td {
  padding: 0;
  margin: 0;
}

.displace-explain {
  font-size: 0.26rem;
  color: #666666;
  font-family: "PingFangSC Regular";
  line-height: 0.42rem;
}

.body-sep {
  width: 6.9rem;
  margin-left: 0.3rem;
  height: 1px;
  background-color: #E6E6E6;
}
</style>
